﻿using System.Collections.Generic;
using XQ.RequestOfficeSupplies.DAL.DAL;
using XQ.RequestOfficeSupplies.DAL;
using XQ.RequestOfficeSupplies.DAL.Model.Sys;

namespace XQ.RequestOfficeSupplies.BLL.Sys
{
    public class ButtonMenuBll
    {
        readonly ButtonMenuDal _buttonMenu = new ButtonMenuDal();

        /// <summary>
        /// 返回所有的按钮
        /// </summary>
        /// <returns></returns>
        public List<Sys_Buttons> GetButtonses()
        {
            return _buttonMenu.GetButtonses();
        }

        /// <summary>
        /// 保存按钮
        /// </summary>
        /// <param name="button"></param>
        /// <returns></returns>
        public string SaveButton(Sys_Buttons button)
        {
            return _buttonMenu.SaveButton(button);
        }

        /// <summary>
        /// 删除按钮
        /// </summary>
        /// <param name="id">按钮ID</param>
        /// <returns></returns>
        public bool DeleteButton(int id)
        {
            return _buttonMenu.DeleteButton(id);
        }
        /// <summary>
        /// 获取单个按钮信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Sys_Buttons GetButton(int id)
        {
            return _buttonMenu.GetButton(id);
        }

        /// <summary>
        /// 返回菜单页面按钮个数
        /// </summary>
        /// <param name="menuId"></param>
        /// <returns></returns>
        public bool GetMenuButtonsesInfo(int menuId, int btnId)
        {
            return _buttonMenu.GetMenuButtonsesInfo(menuId, btnId);
        }
        /// <summary>
        /// 保存页面按钮
        /// </summary>
        /// <param name="menuId">菜单ID</param>
        /// <param name="btnId">菜单ID</param>
        /// <param name="flag">标记</param>
        public void SaveMenuButtons(int menuId, int btnId, bool flag)
        {
            _buttonMenu.SaveMenuButtons(menuId, btnId, flag);
        }

        /// <summary>
        /// 获取按钮菜单根据角色ID
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <returns></returns>
        public List<MenuButtonModel> GetMenuButtons(int roleId)
        {
            return _buttonMenu.GetMenuButtons(roleId);
        }
    }
}
